//
//  SRPersonalDataCellTableViewCell.m
//  SportRing
//
//  Created by icelee on 14-11-1.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "SRPersonalDataCell.h"
#import "UIImageView+RoundImage.h"
#import  <SDWebImage/UIImageView+WebCache.h>

@implementation SRPersonalDataCellModel

- (id)initWithTitle:(NSString *)title content:(NSString *)content headerImage:(NSString *)headerImageUrl
{
    self = [super init];
    if (self)
    {
        self.titleString = title;
        self.contentString = content;
        self.headerImageUrl = headerImageUrl;
    }
    return self;
}

@end

@interface SRPersonalDataCell()

@property (nonatomic, weak)IBOutlet UILabel *srTitleLabel;
@property (nonatomic, weak)IBOutlet UILabel *srContentLabel;
@property (nonatomic, weak)IBOutlet UIImageView *srContentImageView;
@property (nonatomic, weak)IBOutlet UIView *customBackgroundView;
@end

@implementation SRPersonalDataCell

- (void)setSRPersonalDataCellData:(SRPersonalDataCellModel *)model
{
    self.srTitleLabel.text = model.titleString;
    self.srContentLabel.text = model.contentString;
    
    //TO DO: set image.
   
    [self.srContentImageView sd_setImageWithURL:[NSURL URLWithString:model.headerImageUrl] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
         [self.srContentImageView setRoundImage:image];
    }];
}

- (void)awakeFromNib {
    
    [super awakeFromNib];
    // Initialization code
    //圆角
    self.customBackgroundView.layer.cornerRadius = 3;
    
    //阴影
    CALayer * layer = [self.customBackgroundView layer];
    [layer setShadowOffset:CGSizeMake(0, 0.5)];
    [layer setShadowRadius:1.0];
    [layer setShadowOpacity:0.3];
    [layer setShadowColor:[UIColor lightGrayColor].CGColor];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
